@echo off

setlocal
set name=%~1

if "%name%"=="" (
    rem echo 请传入com端口名称
    exit /b 1
)

rem echo %name%

for /f "tokens=1* delims==" %%I in ('wmic path win32_pnpentity get caption /format:list ^| find "%name%"') do (
    REM call :setCOM "%%~J"
    REM echo "%%~J"
    exit /b 0
)
exit /b 404

goto:eof